

package com.dog.basics.admin.controller.common;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dog.basics.bean.dto.admin.common.AdminDogComFeedbackFromDto;
import com.dog.basics.bean.vo.admin.common.AdminDogComFeedbackVo;
import com.dog.basics.common.annotation.SysLog;
import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.util.R;
import com.dog.basics.service.common.DogComFeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;


/**
 * 意见反馈
 *
 * @author cy code generator
 * @date 2021-02-22 15:04:46
 */
@RestController
@AllArgsConstructor
@RequestMapping("/admin/dogcomfeedback")
@Api(value = "意见反馈管理", tags = "意见反馈管理")
public class DogComFeedbackController {

    private final DogComFeedbackService dogComFeedbackService;

    /**
     * 分页查询
     *
     * @param page 分页对象
     * @param obj  意见反馈
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "admin_dogcomfeedback_view")
    @GetMapping("/page")
    @PreAuthorize("@pms.hasPermission('admin_dogcomfeedback_view')")
    public R<IPage<AdminDogComFeedbackVo>> getDogComFeedbackPage(PageParam page, AdminDogComFeedbackFromDto obj) {
        return R.ok(dogComFeedbackService.getAdminPageList(page, obj));
    }


    /**
     * 通过id查询意见反馈
     *
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id查询", notes = "admin_dogcomfeedback_info")
    @GetMapping("/{id}")
    @PreAuthorize("@pms.hasPermission('admin_dogcomfeedback_info')")
    public R<AdminDogComFeedbackVo> getById(@PathVariable("id") Long id) {
        return R.ok(dogComFeedbackService.getAdminObjXq(id));
    }

    /**
     * 通过id删除意见反馈
     *
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除意见反馈", notes = "admin_dogcomfeedback_del")
    @SysLog("通过id删除意见反馈")
    @DeleteMapping("/{id}")
    @ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "Long")
    @PreAuthorize("@pms.hasPermission('admin_dogcomfeedback_del')")
    public R<Boolean> removeById(@PathVariable Long id) {
        return R.ok(dogComFeedbackService.deleteObj(id));
    }

    /**
     * @功能描述: 意见处理
     * @author He
     * @date 2020/5/22
     */
    @SysLog("意见处理")
    @ApiOperation(value = "意见处理", notes = "admin_dogcomfeedback_cl")
    @PreAuthorize("@pms.hasPermission('admin_dogcomfeedback_cl')")
    @PutMapping("/cl/{id}")
    @ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "Long")
    public R<Boolean> editFeedback(@PathVariable Long id) {
        return R.ok(dogComFeedbackService.editFeedback(id));
    }


}
